﻿using System;
using System.Data;
using System.Configuration;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Web.UI.HtmlControls;
using System.Collections;
using System.IO;

/// <summary>
/// ObjectFunction 的摘要说明
/// </summary>
public class ObjectFunction
{
    public ObjectFunction()
    {
        //
        // TODO: 在此处添加构造函数逻辑
        //
    }

    public DataTable GetFlowDes()
    {
        string _cacheKey="g_cache_flowdes";
        DataTable dt=HttpContext.Current.Cache[_cacheKey] as DataTable;
        if (dt == null)
        {
            dt = new DataTable("FlowName");
            string flowDefPath = string.Format("{0}\\WorkFlow\\", EEPRegistry.Server);
            DirectoryInfo dir = new DirectoryInfo(flowDefPath);
            if (dir.Exists)
            {
                object[] obj = Srvtools.CliUtils.CallFLMethod("GetFLDescriptions", new object[] { flowDefPath });
                if (Convert.ToInt16(obj[0]) == 0)
                {
                    ArrayList flDescs = (ArrayList)obj[1];
                    flDescs.Insert(0, " ");
                    dt.Columns.Add("Des");
                    for (int i = 0; i < flDescs.Count; i++)
                    {
                        if (flDescs[i].ToString().Trim() != "")
                        {
                            DataRow dr = dt.NewRow();
                            dr["Des"] = flDescs[i];
                            dt.Rows.Add(dr);
                        }
                    }

                }
           }
            System.Web.Caching.CacheDependency CacheDependencyXmlFile=new System.Web.Caching.CacheDependency(flowDefPath);
            HttpContext.Current.Cache.Insert(_cacheKey, dt, CacheDependencyXmlFile);
        }
        return dt;
    }


    
}
